package com.jcl.elasticsearch.api.controller;

import com.jcl.core.resp.ApiResponse;
import com.jcl.elasticsearch.recruit.service.RecruitElasticService;
import com.jcl.elasticsearch.resume.model.ResumeExternalMsg;
import com.jcl.elasticsearch.resume.service.ResumeCrawlerService;
import com.jcl.elasticsearch.resume.vo.ResumeCrawlerExportParam;
import com.jcl.elasticsearch.resume.vo.SearchDownloadParamEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @ClassName ProducerController
 * @Description TODO
 * @Author yyliu
 * @Date 2018/11/12 17:00
 * @Version 1.0
 **/
@RestController
@RequestMapping("/elastic/resume")
public class ResumeOperateController {

    @Autowired
    private RecruitElasticService recruitElasticService;

    /* *
     * @Description //TODO
     * @Date 10:47 2018/11/13
     * @return
     **/
    @RequestMapping(value = "/operate/download", method = RequestMethod.POST)
    public ApiResponse download(@RequestBody SearchDownloadParamEntity entity) {

        ResumeExternalMsg resumeExternalMsg =
                recruitElasticService.download(entity.getTenantId(), entity.getCorpCode(), entity.getResumeId());

        if(null == resumeExternalMsg){
            return ApiResponse.error("没有外部关联信息");
        }

        return ApiResponse.success(resumeExternalMsg);
    }


}
